
package com.punch.common.feign;


import com.punch.common.constant.ServiceNameConstants;
import com.punch.common.dto.login.WXUserDTO;
import com.punch.common.feign.fallback.FeignGuardianServiceFallbackFactory;
import com.punch.common.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


/**
 * 家长端远程调用
 */
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = FeignGuardianServiceFallbackFactory.class, decode404 = true)
public interface FeignGuardianService {

    /**
     * 根据openId获取小程序登录信息
     *
     * @param openId 小程序openId
     */
    @GetMapping(value = "/guardian/openid/{openid}")
    LoginUser getFeignGuardianByOpenId(@PathVariable(value = "openid") String openId);

    /**
     * 进行注册,不存在则注册,存在则返回
     *
     * @param wxUserDTO 微信用户表单
     */
    @PostMapping(value = "/guardian/openid/mobile")
    void saveFeignGuardian(@RequestBody WXUserDTO wxUserDTO);
}

